
<script type="text/javascript" src="../addons/ewei_shopv2/static/js/dist/area/cascade.js"></script>

{php $field_data_name = empty($field_data_name)?'field_data':$field_data_name}
{php $i=0;}
{loop $fields $k1 $v1}
<div class="form-group">
    <label class="col-sm-2 control-label {if $v1['tp_must'] == 1}must{/if}">{$v1['tp_name']}</label>
    <div class="col-sm-9 col-xs-12">

        {if $v1['data_type'] == 0}
        <input type="text" class='form-control'
               name='{$field_data_name}{php echo $i}'
               placeholder="{if !empty($v1['placeholder'])}{$v1['placeholder']}{else}请输入{$v1['tp_name']}{/if}"
               value="{php echo $f_data[$k1]}"
               {if $v1['tp_must'] == 1}data-rule-required='true'{/if}
        />
        {elseif $v1['data_type']==1}

              <textarea class="form-control" id='{$field_data_name}{php echo $i}' name='{$field_data_name}{php echo $i}'
                        placeholder="{if !empty($v1['placeholder'])}{$v1['placeholder']}{else}请输入{$v1['tp_name']}{/if}"
                        {if $v1['tp_must'] == 1}data-rule-required='true'{/if}
        >{php echo $f_data[$k1]}</textarea>

        {elseif $v1['data_type']==2}

        <select id='{$field_data_name}{php echo $i}' name='{$field_data_name}{php echo $i}' class="form-control"  {if $v1['tp_must'] == 1}data-rule-required='true'{/if}>
        <option value=''>请选择{$v1['tp_name']}</option>
        {loop $v1['tp_text'] $k2 $v2}
        <option value="{php echo $v2}" {if $f_data[$k1] == $v2}selected{/if}>{php echo $v2}</option>
        {/loop}
        </select>

        {elseif $v1['data_type']==3}
        {loop $v1['tp_text'] $k2 $v2}
        <label class="checkbox-inline">
            <input type="checkbox" name='{$field_data_name}{php echo $i}[]' {if is_array($f_data[$k1]) &&  in_array($v2, $f_data[$k1])}checked{/if} value="{php echo $v2}"/> {php echo $v2}
        </label>
        {/loop}
        {elseif $v1['data_type']==5}
        {php echo tpl_form_field_multi_image($field_data_name.$i, $f_data[$k1])}

        {elseif $v1['data_type']==6}
        <input type="tel" class='form-control' id='{$field_data_name}{php echo $i}' name='{$field_data_name}{php echo $i}' placeholder="请输入{$v1['tp_name']}"
               maxlength="18" value="{php echo $f_data[$k1]}"
               {if $v1['tp_must'] == 1}data-rule-required='true'{/if}
        />
        {elseif $v1['data_type']==7}
        {php echo tpl_form_field_date($field_data_name.$i,$f_data[$k1])}

        {elseif $v1['data_type']==8}
        {php echo tpl_form_field_daterange($field_data_name.$i,array('starttime'=>$f_data[$k1][1],'endtime'=>$f_data[$k1][1]))}
        {else if $v1['data_type'] == 9}

        <select id="sel-provance{$i}" name='{$field_data_name}_province{$i}' onchange="selectCity('{$i}');" class="form-control" style='width:200px;display: inline-block' >
            <option value="" selected="true">请选择省份</option>
        </select>
        <select id="sel-city{$i}" name='{$field_data_name}_city{$i}'  onchange="selectcounty('{$i}')" class="form-control" style='width:200px;display: inline-block' >
            <option value="" selected="true">请选择城市</option>
        </select>
        <select id="sel-area{$i}" name='{$field_data_name}_area{$i}'  class="form-control" style='width:200px;display: inline-block;display:none;' >
            <option value="" selected="true">请选择</option>
        </select>
        <script language='javascript'>
            cascdeInit("{php echo isset($f_data[$k1]['province'])?$f_data[$k1]['province']:''}","{php echo  isset($f_data[$k1]['city'])?$f_data[$k1]['city']:''}","",'{$i}');
        </script>
        {/if}
    </div>
</div>
{php $i++}
{/loop}
